package org.grpc.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * description:
 *
 * @author shun.chen
 * @date 2022/5/12
 */
@Api(value = "测试告警接口")
@Slf4j
@RestController
public class AlarmController {

    /**
     * 每次调用睡眠1.5秒，模拟超时的报警
     *
     * @return
     */
    @ApiOperation("告警测试")
    @GetMapping("/timeout")
    public String timeout() {
        log.info("告警测试");
        try {
            Thread.sleep(1500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "timeout";
    }

}
